package com.jiangjun.fetch.filter;

import java.util.HashMap;

import com.jiangjun.fetch.common.WebContext;

public class FilterChain {

	private HashMap<String, Filter> filterMap ;
	
	
	public HashMap<String, Filter> getFilterMap() {
		return filterMap;
	}


	public void setFilterMap(HashMap<String, Filter> filterMap) {
		this.filterMap = filterMap;
	}


	public void doProcess(WebContext ctx,String nextFilerName) throws Exception{
		if(Thread.currentThread().isInterrupted())
		{
			throw new InterruptedException();
		}
		String nextName = filterMap.get(nextFilerName).doProcess(ctx);
		if(nextName != null && !"".equals(nextName))
		{
			doProcess(ctx, nextName);
		}
	}
}
